<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>botbase &mdash; GOZERWAVE v0.1 BETA documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '0.1 BETA',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="GOZERWAVE v0.1 BETA documentation" href="../index.html" />
    <link rel="next" title="channelbase" href="channelbase.html" />
    <link rel="prev" title="boot" href="boot.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="channelbase.html" title="channelbase"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="boot.html" title="boot"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">GOZERWAVE v0.1 BETA documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="botbase">
<h1>botbase<a class="headerlink" href="#botbase" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-gozerlib.botbase">
<h2>description<a class="headerlink" href="#module-gozerlib.botbase" title="Permalink to this headline">¶</a></h2>
<p>base class for all bots.</p>
<dl class="class">
<dt id="gozerlib.botbase.BotBase">
<em class="property">class </em><tt class="descclassname">gozerlib.botbase.</tt><tt class="descname">BotBase</tt><big>(</big><em>name</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#gozerlib.botbase.BotBase" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a title="(in Python v2.7)" class="reference external" href="http://docs.python.org/dev/library/functions.html#object"><tt class="xref docutils literal"><span class="pre">object</span></tt></a></p>
<dl class="method">
<dt id="gozerlib.botbase.BotBase.doevent">
<tt class="descname">doevent</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#gozerlib.botbase.BotBase.doevent" title="Permalink to this definition">¶</a></dt>
<dd><p>dispatch an event.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>event</em> &#8211; event to dispatch.</td>
</tr>
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">None</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="gozerlib.botbase.BotBase.ownercheck">
<tt class="descname">ownercheck</tt><big>(</big><em>userhost</em><big>)</big><a class="headerlink" href="#gozerlib.botbase.BotBase.ownercheck" title="Permalink to this definition">¶</a></dt>
<dd><p>check if provided userhost belongs to an owner.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>userhost</em> (string) &#8211; userhost to check.</td>
</tr>
<tr class="field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="gozerlib.botbase.BotBase.say">
<tt class="descname">say</tt><big>(</big><em>channel</em>, <em>txt</em><big>)</big><a class="headerlink" href="#gozerlib.botbase.BotBase.say" title="Permalink to this definition">¶</a></dt>
<dd><p>override this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>channel</em> (string) &#8211; channel to send txt to</li>
<li><em>txt</em> (string) &#8211; text to send</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">None</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="gozerlib.botbase.BotBase.sayroot">
<tt class="descname">sayroot</tt><big>(</big><em>channel</em>, <em>txt</em><big>)</big><a class="headerlink" href="#gozerlib.botbase.BotBase.sayroot" title="Permalink to this definition">¶</a></dt>
<dd><p>override this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>channel</em> (string) &#8211; channel to send txt to</li>
<li><em>txt</em> (string) &#8211; text to send</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">None</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="code">
<h2>code<a class="headerlink" href="#code" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><pre> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85</pre></td><td class="code"><div class="highlight"><pre><span class="c"># gozerlib/botbase.py</span>
<span class="c">#</span>
<span class="c">#</span>

<span class="sd">&quot;&quot;&quot; base class for all bots. &quot;&quot;&quot;</span>

<span class="c">## gozerlib imports</span>

<span class="kn">from</span> <span class="nn">plugins</span> <span class="kn">import</span> <span class="n">plugs</span>
<span class="kn">from</span> <span class="nn">less</span> <span class="kn">import</span> <span class="n">Less</span>

<span class="c">## basic imports</span>

<span class="kn">import</span> <span class="nn">time</span>

<span class="k">class</span> <span class="nc">BotBase</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">nick</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">outcache</span> <span class="o">=</span> <span class="n">Less</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">channels</span> <span class="o">=</span> <span class="p">{}</span>

    <span class="k">def</span> <span class="nf">doevent</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>

        <span class="sd">&quot;&quot;&quot; </span>
<span class="sd">            dispatch an event. </span>

<span class="sd">            :param event: event to dispatch.</span>
<span class="sd">            :rtype: None</span>

<span class="sd">        &quot;&quot;&quot;</span>

        <span class="n">plugs</span><span class="o">.</span><span class="n">dispatch</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">ownercheck</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">userhost</span><span class="p">):</span>

        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">            check if provided userhost belongs to an owner. </span>

<span class="sd">            :param userhost: userhost to check.</span>
<span class="sd">            :type userhost: string</span>
<span class="sd">            :rtype: boolean</span>

<span class="sd">        &quot;&quot;&quot;</span>

        <span class="kn">from</span> <span class="nn">gozerlib.config</span> <span class="kn">import</span> <span class="n">Config</span>
        <span class="n">config</span> <span class="o">=</span> <span class="n">Config</span><span class="p">(</span><span class="s">&#39;mainconfig&#39;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">userhost</span> <span class="ow">in</span> <span class="n">config</span><span class="p">[</span><span class="s">&#39;owner&#39;</span><span class="p">]:</span>
            <span class="k">return</span> <span class="bp">True</span>

        <span class="k">return</span> <span class="bp">False</span>

    <span class="k">def</span> <span class="nf">say</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span> <span class="n">txt</span><span class="p">):</span>

        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">            override this. </span>

<span class="sd">            :param channel: channel to send txt to</span>
<span class="sd">            :type channel: string</span>
<span class="sd">            :param txt: text to send</span>
<span class="sd">            :type txt: string</span>
<span class="sd">            :rtype: None</span>

<span class="sd">        &quot;&quot;&quot;</span>

        <span class="k">pass</span>

    <span class="k">def</span> <span class="nf">sayroot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">channel</span><span class="p">,</span> <span class="n">txt</span><span class="p">):</span>

        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">            override this. </span>

<span class="sd">            :param channel: channel to send txt to</span>
<span class="sd">            :type channel: string</span>
<span class="sd">            :param txt: text to send</span>
<span class="sd">            :type txt: string</span>
<span class="sd">            :rtype: None</span>

<span class="sd">        &quot;&quot;&quot;</span>

        <span class="k">pass</span>
</pre></div>
</td></tr></table></div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">botbase</a><ul>
<li><a class="reference external" href="#module-gozerlib.botbase">description</a></li>
<li><a class="reference external" href="#code">code</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="boot.html"
                                  title="previous chapter">boot</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="channelbase.html"
                                  title="next chapter">channelbase</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/gozerlib/botbase.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="channelbase.html" title="channelbase"
             >next</a> |</li>
        <li class="right" >
          <a href="boot.html" title="boot"
             >previous</a> |</li>
        <li><a href="../index.html">GOZERWAVE v0.1 BETA documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2009, Bart Thate.
      Last updated on Nov 14, 2009.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
    </div>
  </body>
</html>